<?php
/**
 * ���ã� ��ģ�����ڴ���΢�ŷ�����ƽ̨����Ϣ
 * ����: shijy@soe-soe.com
 * ����: 2016/5/6 10:32
 * ��˾: �㽭��������Ƽ����޹�˾<www.soe-soe.com>
 */


namespace WeiXin\Controller;
use Think\Controller;
use Think\Exception;


class IndexController extends Controller {
    /**
     * 被动应答
     * Author: shijy
     */
    public function index(){
        global $engine;
        try{
            vendor("SoeWX.SoEngine");
        }catch(Exception $e){
        }
    }

    /**
     * 主动消息发送
     * Author: shijy
     */
    
    public function sendMsg(){
        global $engine;
        try{

            vendor("SoeWX.do");
            $acc = \WeiXinAccount::create(3);
            $send['touser'] = 'o3y9js2XL31H0v0zmfB4AX9owCoM';
            $send['msgtype'] = 'text';

            $send['text'] = array('content' => urlencode('你好呀，我是客服'.time()));
            $data = $acc->sendCustomNotice($send);
            
        }catch(Exception $e){

        }
    }

    public function indexs(){
        vendor("SoeWX.wechatCallbackapi");
        $wechatObj = new \wechatCallbackapi();
        if (!isset($_GET['echostr'])) {
            $wechatObj->responseMsg();
        }else{
            $wechatObj->valid();
        }
    }
}